<?php require_once(dirname(__FILE__)."/../config/config.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?php  
if($_SESSION['admin_name']=="")
{

	echo "<script>location.href='admin_login.php';</script>";
}
?>
 <?php
     switch($_GET["action"]){
	 	case "add":
	
if($_POST['content']!=""&&$_POST['title']!="")
{
	// $id = $_GET['id'];
		$sql="INSERT INTO zy_content (content,title)
VALUES
('$_POST[content]','$_POST[title]')";
	
   mysql_query($sql);
	$id=mysql_insert_id($myconn);
	//echo $sql;
	echo "<h3>页面信息发送成功!</h3>";
	echo "<a href='page.php'>浏览页面信息</a>  ";
 
  echo "<a href='page_add.php'>返回</a>&nbsp;&nbsp;";

}else{
	echo "<script>alert('不能为空，请如实填写')</script>";
	echo "<script>location.href='page_add.php';</script>";
}

 		break;
		case  "del":
	$id = $_GET['id'];
	$page=$_REQUEST['page'];
	$sql = "delete from zy_content where id = '".$id."'";
	mysql_query($sql);
	header("location:page.php?page=".$page);
	break;
	case "update":
	$content = $_POST["content"];
	$id=$_GET['id'];
	$page=$_REQUEST['page'];
	$sql = "update zy_content set  content='".$content."' where   id ='".$id."'";
   // echo $sql;
	mysql_query($sql);
	header("location:page.php?page=".$page);
	break;
}
?>
</body>
</html>